<!DOCTYPE html>
<html>
    <head>
        <!-- 页面meta -->
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <title>传智健康</title>
        <meta name="description" content="传智健康">
        <meta name="keywords" content="传智健康">
        <meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name="viewport">
        <!-- 引入样式 -->
        <link rel="stylesheet" href="../plugins/elementui/index.css">
        <link rel="stylesheet" href="../css/login.css">

    </head>
    <body class="hold-transition skin-purple sidebar-mini">
        <div id="app">
            <div class="login-container">
                <div class="loginBox">
                    <el-form ref="dataAddForm" :model="formData" label-position="right" label-width="100px">
                        <el-row>
                            <el-col :span="18">
                                <el-form-item label="用户账号" prop="username">
                                    <el-input  v-model="formData.username" show-password/>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>
                            <el-col :span="18">
                                <el-form-item label="旧密码" prop="oldPassword">
                                    <el-input  v-model="formData.oldPassword" show-password/>
                                </el-form-item>
                            </el-col>
                        </el-row>
                        <el-row>

                        <el-col :span="18">
                            <el-form-item label="新密码" prop="newPassword">
                                <el-input show-password v-model="formData.newPassword"/>
                            </el-form-item>
                        </el-col>
                    </el-row>
                            <el-button> <a href="/pages/main.html">取消</a></el-button>
                            <el-button type="primary" @click="changePassword()">确定</el-button>
                            <el-button type="primary" plain><a href="/logout.do">回到登录界面</a></el-button>
                    </el-form>

                </div>
              </div>
        </div>
    </body>
    <!-- 引入组件库 -->
    <script src="../js/vue.js"></script>
    <script src="../plugins/elementui/index.js"></script>
    <script src="../js/axios-0.18.0.js"></script>
<script>
    new Vue({
        el:"#app",
        data:{
            formData:{},
        },
        methods:{
            //提交修改密码
            changePassword(){
                axios.post("/user/changePassword.do?",this.formData).then(res=>{
                    this.$message({
                        message: res.data.message,
                        type: res.data.flag ? 'success':"error"
                    });
                    if (res.data.flag){
                        this.formData = {};
                    }
                })
            }
        }
    })
</script>
</html>
